#
# Iterator Class for Ruby
#

module Soul

class Iterator

	include Comparable
	
	def initialize(string, index=0)
		@index = index
		@string = string
	end

	def index
		@index
	end

	def +(number)
		@index += number
	end

	def next
		@index += 1
		self
	end	

	alias :succ :next

	def previous
		@index -= 1
		self
	end

	def to_str
		@string[@index]
	end

	def <=>(what)
		@string[@index] <=> what
	end

end

end # module
